package com.baor.controller;

import com.baor.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
@RestController
@RequestMapping(value="/user")
@CrossOrigin(origins = "*")
public class WeChatController {
    @Autowired
    private UserService userService;
    @RequestMapping(value="/hello")
    public String hello(@RequestBody Map<String,Object> params) {
        System.out.println(params);
        this.userService.login(params);
        return "hello miniprogram";
    }

    @RequestMapping(value="/getPhoneNumber")
    public String getPhoneNumber(@RequestBody Map<String,Object> params) {
        return this.userService.getPhoneNumber(params);
    }

    @RequestMapping(value="/getUserInfo")
    public String getUserInfo(@RequestBody Map<String,Object> params){
        return this.userService.getUserInfo(params);
    }
}
